package com.xzh.api;

import com.xzh.service.EcharsService;
import com.xzh.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/v1/echarts")
public class EcharsApi {
    private EcharsService echarsService;

    @Autowired
    public void setEcharsService(EcharsService echarsService) {
        this.echarsService = echarsService;
    }

    @GetMapping("/statistics")
    public ResponseEntity<JsonResult<?>> statistics() {
        List<Map<String, Object>> statistics = echarsService.statistics();
        return ResponseEntity.ok(JsonResult.success(statistics));
    }
}
